package com.financing.platform.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.financing.platform.dao.IOrderManagerUserDao;
import com.financing.platform.dto.OrderManagerUserDTO;
import com.financing.platform.util.SqlName;
import com.financing.platform.vo.OrderManagerUserVO;

@Repository("orderManagerUserDaoImpl")
public class OrderManagerUserDaoImpl extends BaseDaoImpl implements IOrderManagerUserDao {
	
	/**
	 * 添加订单管理员
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int addOrderManagerUser(OrderManagerUserDTO user) throws SQLException{
		return (Integer)this.sqlMapClient.insert(SqlName.addOrderManagerUser,user);
	}
	
	/**
	 * 删除订单管理员
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int deleteOrderManagerUser(OrderManagerUserVO user) throws SQLException{
		return this.sqlMapClient.delete(SqlName.deleteOrderManagerUser, user);
	}
	
	/**
	 * 查询所有的订单管理员
	 * @return
	 * @throws SQLException
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<OrderManagerUserVO> queryOrderManagerUsers(OrderManagerUserVO user) throws SQLException{
		return this.sqlMapClient.queryForList(SqlName.queryOrderManagerUsers, user);
	}
	
	/**
	 * 查询所有订单管理员的数量
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int queryOrderManagerUsersCount(OrderManagerUserVO user) throws SQLException{
		return (Integer)this.sqlMapClient.queryForObject(SqlName.queryCountOfOrderManagerUsers, user);
	}
	
	/**
	 * 查询还未添加的管理员
	 * @return
	 * @throws SQLException
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<OrderManagerUserVO> queryNotOrderManagerUsers(OrderManagerUserVO user) throws SQLException{
		return this.sqlMapClient.queryForList(SqlName.queryNotOrderManagerUsers, user);
	}
	
	/**
	 * 查询所有订单管理员的数量
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int queryNotOrderManagerUsersCount(OrderManagerUserVO user) throws SQLException{
		return (Integer)this.sqlMapClient.queryForObject(SqlName.queryCountOfNotOrderManagerUsers, user);
	}
}
